package fhp.hlhj.giantfold.javaBean;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.webkit.JavascriptInterface;

import com.zipingfang.android.yst.ui.utils.GoodsUtils;

import org.greenrobot.eventbus.EventBus;

import fhp.hlhj.giantfold.activity.user.ReportAty;
import fhp.hlhj.giantfold.event.JsEvent;
import fhp.hlhj.giantfold.utils.LogUtil;

/**
 * Created by Administrator on 2018\2\10 0010.
 */

public class JsHelper extends Object {
    private Activity context;
    public JsHelper(Activity context) {
        this.context = context;
    }
    @JavascriptInterface
    public void hello(String msg){
        LogUtil.INSTANCE.log("调用了我的方法");
        GoodsUtils.showChatActivity(context,new GoodsUtils.ChatActivityListener(){
            @Override
            public void beforeShow() {

            }

            @Override
            public void afterShow() {

            }

        });
    }
    @JavascriptInterface
    public void goReport(){
        context.startActivity(new Intent(context, ReportAty.class));
    }
    @JavascriptInterface
    public void goBack(){
        EventBus.getDefault().post(new JsEvent());

    }
    @JavascriptInterface
    public void finishIt(){
        context.finish();
    }

}
